﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Bzure.Security;
using Bzure.Security.Permissions;
using Bzure.Common.Patterns;
using Bzure.Common.Core;

namespace Bzure.Apps.Security
{
    public static class ContractManager
    {
        public static IAccountContract AsAccountManager(this Public Public)
        {
            IAccountContract AccountContract = Public.BuildContractProvider<IAccountContract>();
            if (AccountContract == default(IAccountContract))
                throw new Exception("IAccountContract接口没有被实现");
            return AccountContract;
        }
        
        public static IUserContract AsUserManager(this Public Public)
        {
            IUserContract IUserContract = Public.BuildContractProvider<IUserContract>();
            if (IUserContract == default(IUserContract))
                throw new Exception("IUserContract接口没有被实现");
            return IUserContract;
        }
        public static IRoleContract AsRoleManager(this Public Public)
        {
            IRoleContract IRoleContract = Public.BuildContractProvider<IRoleContract>();
            if (IRoleContract == default(IRoleContract))
                throw new Exception("IRoleContract接口没有被实现");
            return IRoleContract;
        }
        public static IUserGroupContract AsUserGroupManager(this Public Public)
        {
            IUserGroupContract IUserGroupContract = Public.BuildContractProvider<IUserGroupContract>();
            if (IUserGroupContract == default(IUserGroupContract))
                throw new Exception("IUserGroupContract接口没有被实现");
            return IUserGroupContract;
        }
    }
}
